<?php

define('Junction_CONFIG', 'Conf/junction.ini');

class Junction_Utils_Config {
	
	/**
	 * Array of config data.
	 *
	 * @var array
	 */
	private $_data;
	
	private static $_path = Junction_CONFIG;
	
	/**
	 * Single instance of the config file.
	 *
	 * @var Junction_Utils_Config
	 */
	private static $_singleton;
	
	/**
	 * Construct a new config utility.
	 *
	 */
	private function __construct() {
		$this->_data = parse_ini_file(self::$_path);
	}
	
	public function setPath($newPath) {
	    self::$_path = $newPath;
	}
	
	/**
	 * Read an article from the config file.
	 *
	 * @param String $config
	 * @return String
	 */
	public function read($config) {
		return $this->_data[$config];
	}
	
	/**
	 * @return Junction_Utils_Config
	 */
	public static function getSingleton() {
		if (!isset(self::$_singleton)) {
			self::$_singleton = new Junction_Utils_Config();
		}
		return self::$_singleton;
	}
}
?>